home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 2743 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.0 KB

  1. Path: slip037.csc.cuhk.hk!user
  2. From: jderrick@cuhk.edu.hk (James Derrick)
  3. Newsgroups: comp.lang.pascal.borland,comp.lang.pascal.mac,comp.lang.pascal.ansi-iso,comp.lang.pascal.misc,comp.sys.amiga.programmer,comp.graphics.algorithms,comp.os.ms-windows.programmer.graphics,comp.sys.amiga.graphics
  4. Subject: Re: 3d programming
  5. Date: 5 Feb 1996 07:49:47 GMT
  6. Organization: The Chinese University of Hong Kong
  7. Message-ID: <jderrick-0502961551360001@slip037.csc.cuhk.hk>
  8. References: <4f3od9$2jg@zeus.tcp.co.uk>
  9. NNTP-Posting-Host: @slip037.csc.cuhk.hk
  10.  
  11. In article <4f3od9$2jg@zeus.tcp.co.uk>, agale@agale.tcp.co.uk (Aaron Gale)
  12. wrote:
  13.  
  14. > Does anyone know how to find the intersection of a line and plane
  15. > in simple x,y and z cartesian coordinates.  I have a model made
  16. > up of facets, each facet being defined by 4 points.  The working
  17. > envelope that this model is in, is then scanned from the bottom
  18. > to the top.  However I can't work out how to calculate the z
  19. > coordinate along the scan line that may intersect with a facet.
  20. > The scanning line is always horizontal and is defined with the
  21. > x and y coordinates remaining the same, with one end of the line
  22. > minus z and the other end positive z. As an example at what point
  23. > does the line whose start point is (54,46,-100) and whose end
  24. > point is (54,46,100) intersect with a plane facet defined by 4
  25. > points in a anti-clockwise direction point 1 (40,20,-70),
  26. > point 2 (40,60,-40), point 3 (120,60,-40) and point 4 (120,20,-70).
  27.  
  28. You only need 3 points to define a plane.  Using these three points you
  29. can calculate the equation for the plane by simulaneous equations.
  30. ie using the first 3 points the equation using a form of z=mx+ny+b would be:
  31.  
  32. 1.  -70 = 40m + 20n + b
  33. 2.  -40 = 40m + 60n + b
  34. 3.  -40 = 120m + 60n + b
  35.  
  36. Solving these gives m=0,n=0.75,b=-85.
  37. If you had a more complicated line you could solve the intersection also
  38. by the same method, however as all x & y values are the same, you can just
  39. substitute the x & y in, which gives you the intersection at (54,46,-50.5)
  40.  
  41. -- 
  42. James Derrick
  43.